// let str1 = readline();
// let str2 = readline();
let str1 = "hello123world";
let str2 = "helloabc4hello123ughnshgg";
let result = "";
let start = 0;
let end = 1;
while(end <= str2.length){
    let subStr = str2.substring(start, end);
    if (str1.includes(subStr)){
        result = subStr;
    }else {
        start++;
    }
    end++;
}
console.log(result);